{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# python知识点的总结"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "python_base={\n",
    "    \"IDE\":{\n",
    "        \"IDLE\":\"操作,100(80),意义,100(90),用途:可以通过运行后的shell中的提示去修改编辑器中的代码\",\n",
    "        \"jupyter\":\"操作,100(90),意义,100(85),用途:适合编写多种代码，而且更直观地得出运行的结果\",\n",
    "        \"pycharm\":\"操作,100(85),意义,100(90),用途:编写代码和运行代码在同一页面，相比于IDLE更加方便快捷\"\n",
    "}\n",
    "    }\n",
    "    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 字典\n",
    "## 字典是另一种可变容器模型，并且可以存储任意类型对象。字典的每个键值key=>value对用冒号（：）分割，每个对之间用（，）分割。整个字典包括在大括号{}中。\n",
    "---\n",
    "*键必须是唯一的，但值则不必。*\n",
    "\n",
    "*值可以取任何数据类型，但键必须是不可变的，如字符串，数字*\n",
    "\n",
    "---\n",
    "1. 访问字典里的值：把相应的键放入到[]中。如dict['']\n",
    "2. 修改字典：向字典添加新内容的方法是增加新的键/值对，修改或删除已有键/值对。如dict['']=\n",
    "3. 删除字典元素：能删单一的元素也能清空字典，清空只需一项操作。如：dict.clear()   显示删除一个字典用del命令，如del dict[''"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 字典键的特性\n",
    "### 字典值可以是任何的 python 对象，既可以是标准的对象，也可以是用户定义的，但键不行。两个重要的点：\n",
    "1. 不允许同一个键出现两次。创建时如果同一个键被赋值两次，后一个值会被记住。\n",
    "2. 键必须不可变，所以可以用数字，字符串或元组充当，而用列表就不行。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 字典内置函数、方法\n",
    "\n",
    "|函数|描述|\n",
    "|---:|:--:|\n",
    "|len(dict)|计算字典元素个数，即键的总数。|\n",
    "|str(dict)|输出字典，以可打印的字符串表示。|\n",
    "|type(variable)|返回输入的变量类型，如果变量是字典就返回字典类型。|\n",
    "\n",
    "---\n",
    "\n",
    "|方法|描述|\n",
    "|---:|:--:|\n",
    "|dict.clear()|删除字典内所有元素|\n",
    "|dict.copy()|返回一个字典的浅复制|\n",
    "|dict.fromkeys()|创建一个新字典，以序列seq中元素做字典的键，val为字典所有键对应的初始值|\n",
    "|dict.get(key, default=None)|返回指定键的值，如果键不在字典中返回 default 设置的默认值|\n",
    "|key in dict|如果键在字典dict里返回true，否则返回false|\n",
    "|dict.items()|以列表返回可遍历的(键, 值) 元组数组|\n",
    "|dict.keys()|返回一个迭代器，可以使用 list() 来转换为列表|\n",
    "|dict.setdefault(key, default=None)|和get()类似, 但如果键不存在于字典中，将会添加键并将值设为default|\n",
    "|dict.update(dict2)|把字典dict2的键/值对更新到dict里|\n",
    "|dict.values()|返回一个迭代器，可以使用 list() 来转换为列表|\n",
    "|dict.pop(key[,default])|删除字典给定键 key 所对应的值，返回值为被删除的值。key值必须给出。 否则，返回default值。|\n",
    "|dict.popitem()|随机返回并删除字典中的最后一对键和值。|"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 字典的相关练习\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### clear()方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{}\n"
     ]
    }
   ],
   "source": [
    "score={'语文':98,'数学':90,'英语':95}\n",
    "score.clear()\n",
    "print(score)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### get()方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "98\n"
     ]
    }
   ],
   "source": [
    "score={'语文':98,'数学':90}\n",
    "print(score.get('语文'))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### update()方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'语文': 100, '数学': 100}\n"
     ]
    }
   ],
   "source": [
    "score={'语文':98,'数学':90}\n",
    "score.update({'语文':100,'数学':100})\n",
    "print(score)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### items()、keys()、values()方法\n",
    "##### **items()、keys()、values() 分别用于获取字典中的所有 key-value 对、所有 key、所有 value。**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_items([('语文', 98), ('数学', 90)])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score={'语文':98,'数学':90}\n",
    "score.items()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dict_keys(['语文', '数学'])\n"
     ]
    }
   ],
   "source": [
    "score={'语文':98,'数学':90}\n",
    "print(score.keys())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_values([98, 90])"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score={'语文':98,'数学':90}\n",
    "score.values()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### pop(),popitem()方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'语文': 98}\n"
     ]
    }
   ],
   "source": [
    "score={'语文':98,'数学':90}\n",
    "a=score.pop('数学')\n",
    "print(score)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'语文': 98}\n"
     ]
    }
   ],
   "source": [
    "score={'语文':98,'数学':90}\n",
    "a=score.popitem()\n",
    "print(score)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### setdefault()方法\n",
    "##### *setdefault() 方法也用于根据 key 来获取对应 value 的值。但该方法有一个额外的功能，即当程序要获取的 key 在字典中不存在时，该方法会先为这个不存在的 key 设置一个默认的 value，然后再返回该 key 对应的 value。*"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "90\n",
      "{'语文': 95, '数学': 90, '化学': 90}\n"
     ]
    }
   ],
   "source": [
    "score = {'语文':95 , '数学': 90}\n",
    "print(score.setdefault('化学', 90))\n",
    "print(score)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "python_base={\n",
    "    \"知识点\":{\n",
    "        \"dict\":{\n",
    "            \"clear\":\"操作，100（95），意义，100（90），用途：快速删除字典内的所有元素\",\n",
    "            \"get\":\"操作，100（100），意义，100（95），用途：可以获取字典的某个元素\",\n",
    "            \"update\":\"操作，100（90），意义，100（85），用途：把新字典的键/值对更新到原有的字典里\",\n",
    "            \"items\":\"操作，100（90），意义，100（90），用途：以列表返回可遍历的(键, 值) 元组数组\",\n",
    "            \"keys\":\"操作，100（90），意义，100（95），用途：获取字典中所有的key值\",\n",
    "            \"values\":\"操作，100（90），意义，100（95），用途：获取字典中所有的数值\",\n",
    "            \"pop\"\"popitem\":\"操作，100（85），意义，100（90），用途：删除字典给定键 key 所对应的值，返回值为被删除的值\",\n",
    "            \"setdefault\":\"操作，100（85），意义，100（95），用途：返回指定键的值，如果键不在字典中返回 default 设置的默认值\"\n",
    "            \n",
    "        }\n",
    "    }\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 集合\n",
    "### 集合：\n",
    "#### 集合（set）是一个无序的不重复元素序列。可以用大括号{}或者set()函数来创建一个集合。\n",
    "*注意：创建一个空集合必须要用set()，不能用{}。因为{}是用来创建一个空字典的。*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 集合的一些方法\n",
    "|方法|描述|\n",
    "|---:|:--:|\n",
    "|set.add()|为集合添加元素|\n",
    "|set.clear()|移除集合中的所有元素|\n",
    "|set.copy()|复制一个集合|\n",
    "|set.difference()|返回多个集合的差集|\n",
    "|set.difference_update()|移除集合中的元素，该元素在指定的集合也存在。|\n",
    "|set.discard()|删除集合中指定的元素|\n",
    "|set.intersecrion()|返回集合的交集|\n",
    "|set.intersection_update()|返回集合的交集|\n",
    "|ste.isdisjoint()|判断两个集合是否包含相同的元素，如果没有返回 True，否则返回 False。|\n",
    "|set.issubset()|判断指定集合是否为该方法参数集合的子集。|\n",
    "|set.issuperset()|判断该方法的参数集合是否为指定集合的子集|\n",
    "|set.pop()|随机移除元素|\n",
    "|set.remove()|移除制定元素|\n",
    "|set.symmetric_difference()|返回两个集合中不重复的元素集合。|\n",
    "|set.symmetric_difference_update()|移除当前集合中在另外一个指定集合相同的元素，并将另外一个指定集合中不同的元素插入到当前集合中。|\n",
    "|set.union()|返回两个集合的并集|\n",
    "|set.update()|给集合添加元素|"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 集合的相关练习\n",
    "#### add"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1, 2, 3, 4}\n"
     ]
    }
   ],
   "source": [
    "numb = set((1,2,3))\n",
    "numb.add(4)\n",
    "print(numb)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### clear"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "set()\n"
     ]
    }
   ],
   "source": [
    "numb = set((1,2,3))\n",
    "numb.clear()\n",
    "print(numb)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### copy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1, 2, 3}\n"
     ]
    }
   ],
   "source": [
    "numb1 = set((1,2,3))\n",
    "numb2 = numb1.copy()\n",
    "print(numb2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### difference"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1, 3}\n"
     ]
    }
   ],
   "source": [
    "numb1 = set((1,2,3))\n",
    "numb2 = set((2,4))\n",
    "numb3 = numb1.difference(numb2)\n",
    "print(numb3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### difference_update"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1, 3}\n"
     ]
    }
   ],
   "source": [
    "numb1 = set((1,2,3))\n",
    "numb2 = set((2,4))\n",
    "numb1.difference_update(numb2)\n",
    "print(numb1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### diacard"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1, 3}\n"
     ]
    }
   ],
   "source": [
    "numb1 = set((1,2,3))\n",
    "numb1.discard(2)\n",
    "print(numb1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### intersection "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{2}\n"
     ]
    }
   ],
   "source": [
    "numb1 = set((1,2,3))\n",
    "numb2 = set((2,4))\n",
    "numb3 = numb1.intersection(numb2)\n",
    "print(numb3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### intersection_update"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{2}\n"
     ]
    }
   ],
   "source": [
    "numb1 = set((1,2,3))\n",
    "numb2 = set((2,4))\n",
    "numb1.intersection_update(numb2)\n",
    "print(numb1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### isdisjoint() & issubset() &issuperset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "False\n"
     ]
    }
   ],
   "source": [
    "#numb1.isdisjoint(numb2):判断两个集合中是否有交集，有交集返回 False；没有交集返回 True\n",
    "numb1 = set((1,2,3))\n",
    "numb2 = set((3,4))\n",
    "print(numb1.isdisjoint(numb2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "False\n"
     ]
    }
   ],
   "source": [
    "#numb1.issubset(numb2):判断 numb1 是否是 numb2 的子集\n",
    "numb1 = set((1,2,3))\n",
    "numb2 = set((1,2))\n",
    "print(numb1.issubset(numb2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "True\n"
     ]
    }
   ],
   "source": [
    "# numb1.issuperset(numb2):判断 numb2 是否是 numb1 的子集\n",
    "numb1 = set((1,2,3))\n",
    "numb2 = set((1,2))\n",
    "print(numb1.issuperset(numb2))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### pop() &remove()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{2, 3}\n",
      "1\n"
     ]
    }
   ],
   "source": [
    "numb1 = set((1,2,3))\n",
    "a = numb1.pop()\n",
    "print(numb1)\n",
    "print(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1, 3}\n"
     ]
    }
   ],
   "source": [
    "numb1 = set((1,2,3))\n",
    "numb1.remove(2)\n",
    "print(numb1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### symmetric_difference & symmetric_difference_update"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1, 2, 4}\n"
     ]
    }
   ],
   "source": [
    "# symmetric_difference:numb3 = numb1.symmetric_difference(numb2):取 numb1 和 numb2 中互不相同的元素，给numb3\n",
    "numb1 = set((1,2,3))\n",
    "numb2 = set((3,4))\n",
    "numb3 = numb1.symmetric_difference(numb2)\n",
    "print(numb3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1, 2, 4}\n"
     ]
    }
   ],
   "source": [
    "# symmetric_difference_update:numb1.symmetric_difference_update(numb2):取 numb1 和 numb2 中互不相同的元素，并更新给 numb1\n",
    "numb1 = set((1,2,3))\n",
    "numb2 = set((3,4))\n",
    "numb1.symmetric_difference_update(numb2)\n",
    "print(numb1)\n",
    "#{1, 2, 4}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### union"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1, 2, 3, 4}\n"
     ]
    }
   ],
   "source": [
    "# union:numb3=numb1.union(numb2):取 numb1 和 numb2 的并集，赋给 numb3\n",
    "numb1 = set((1,2,3))\n",
    "numb2 = set((3,4))\n",
    "numb3=numb1.union(numb2)\n",
    "print(numb3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### update"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1, 2, 3, 4}\n"
     ]
    }
   ],
   "source": [
    "# update:numb1.update(elem):添加列表或集合中的元素到 numb1\n",
    "numb1 = set((1,2,3))\n",
    "numb1.update([3,4])\n",
    "print(numb1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "python_base={\n",
    "    \"知识点\":{\n",
    "        \"set\":{\n",
    "            \"add\":\"操作，100（100），意义，100（90）\",\n",
    "            \"clear\":\"操作，100（90），意义，100（95）\",\n",
    "            \"copy\":\"操作，100（100），意义，100（85）\",\n",
    "            \"difference\":\"操作，100（80），意义，100（85）\",\n",
    "            \"difference_update\":\"操作，100（80），意义，100（85）\",\n",
    "            \"diacard\":\"操作，100（70），意义，100（85）\",\n",
    "            \"intersection\":\"操作，100（85），意义，100（90）\",\n",
    "            \"intersection_update\":\"操作，100（85），意义，100（95）\",\n",
    "            \"isdusjoint\" \"issubset\" \"issuperset\":\"操作，100（75），意义，100（85）\",\n",
    "            \"pop\"\"remove\":\"操作，100（85），意义，100（90）\",\n",
    "            \"symmetric_difference\"\"symmetric_difference_update\":\"操作，100（70），意义，100（85）\",\n",
    "            \"union\":\"操作，100（80），意义，100（85）\",\n",
    "            \"update\":\"操作，100（80），意义，100（90）\"\n",
    "            \n",
    "            \n",
    "        }\n",
    "    }\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 列表"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 列表是最常用的 Python 数据类型，它可以作为一个方括号内的逗号分隔值出现。列表的数据项不需要具有相同的类型。创建一个列表，只要把逗号分隔的不同的数据项使用方括号括起来即可。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 访问列表中的值\n",
    "#### 与字符串的索引一样，列表索引从 0 开始，第二个索引是 1，依此类推。通过索引列表可以进行截取、组合等操作。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "red\n"
     ]
    }
   ],
   "source": [
    "list = ['red', 'green', 'blue', 'yellow', 'white', 'black']\n",
    "print( list[0] )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 索引也可以从尾部开始，最后一个元素的索引为 -1，往前一位为 -2，以此类推。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "black\n"
     ]
    }
   ],
   "source": [
    "list = ['red', 'green', 'blue', 'yellow', 'white', 'black']\n",
    "print( list[-1] )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### len() 迅速获取列表中元素的个数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5\n"
     ]
    }
   ],
   "source": [
    "list = [1,2,3,4,5]\n",
    "print(len(list))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### max(list)返回列表元素的最大值/min(list)返回列表元素的最小值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5\n"
     ]
    }
   ],
   "source": [
    "list = [1,2,3,4,5]\n",
    "print(max(list))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n"
     ]
    }
   ],
   "source": [
    "list = [1,2,3,4,5]\n",
    "print(min(list))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 删除列表元素 使用 del 语句来删除列表的的元素"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "删除第三个元素 :  ['Google', 'Runoob', 2000]\n"
     ]
    }
   ],
   "source": [
    "list = ['Google', 'Runoob', 1997, 2000]\n",
    "del list[2]\n",
    "print (\"删除第三个元素 : \", list)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### append() 方法用于在列表末尾添加新的对象。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "list2 :  ['Google', 'Runoob', 'Taobao', 'Baidu']\n"
     ]
    }
   ],
   "source": [
    "list1 = ['Google', 'Runoob', 'Taobao']\n",
    "list1.append('Baidu')\n",
    "print (\"list2 : \", list1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### count() 方法用于统计某个元素在列表中出现的次数。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "123 元素个数 :  2\n"
     ]
    }
   ],
   "source": [
    "aList = [123, 'Google', 'Runoob', 'Taobao', 123];\n",
    "print (\"123 元素个数 : \", aList.count(123))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### index() 函数用于从列表中找出某个值第一个匹配项的索引位置。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Runoob 索引值为 1\n"
     ]
    }
   ],
   "source": [
    "list1 = ['Google', 'Runoob', 'Taobao']\n",
    "print ('Runoob 索引值为', list1.index('Runoob'))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### remove() 函数用于移除列表中某个值的第一个匹配项。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "列表现在为 :  ['Google', 'Runoob', 'Baidu']\n"
     ]
    }
   ],
   "source": [
    "list1 = ['Google', 'Runoob', 'Taobao', 'Baidu']\n",
    "list1.remove('Taobao')\n",
    "print (\"列表现在为 : \", list1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### clear() 函数用于清空列表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "列表清空后 :  []\n"
     ]
    }
   ],
   "source": [
    "list1 = ['Google', 'Runoob', 'Taobao', 'Baidu']\n",
    "list1.clear()\n",
    "print (\"列表清空后 : \", list1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### insert() 函数用于将指定对象插入列表的指定位置。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "列表插入元素后为 :  ['Google', 'Baidu', 'Runoob', 'Taobao']\n"
     ]
    }
   ],
   "source": [
    "list1 = ['Google', 'Runoob', 'Taobao']\n",
    "list1.insert(1, 'Baidu')\n",
    "print ('列表插入元素后为 : ', list1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [],
   "source": [
    "python_base={\n",
    "    \"知识点\":{\n",
    "        \"set\":{\n",
    "            \"索引值\":\"操作，100（100），意义，100（95）\",\n",
    "            \"len\":\"操作，100（95），意义，100（90）\",\n",
    "            \"max\"\"min\":\"操作，100（100），意义，100（90）\",\n",
    "            \"del\":\"操作，100（100），意义，100（90）\",\n",
    "            \"append\":\"操作，100（100），意义，100（95）\",\n",
    "            \"count\":\"操作，100（90），意义，100（85）\",\n",
    "            \"index\":\"操作，100（95），意义，100（90）\",\n",
    "            \"remove\":\"操作，100（95），意义，100（85）\",\n",
    "            \"clear\":\"操作，100（100），意义，100（80）\",\n",
    "            \"insert\":\"操作，100（90），意义，100（85）\"\n",
    "            \n",
    "        }\n",
    "    }\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "341.333px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
